
#ifndef VMATRIX_H
#define VMATRIX_H

typedef struct mstack VMStack ;

#define VM_PROJECTION 1
#define VM_MODELVIEW 2

class VMatrix { 
  VMStack * base;
  VMStack * top;
  float proj[16];
  int mode;
  bool tex;
  public:
  VMatrix ();
  ~VMatrix ();
  void SetMode (int md);
  void Push ();
  void Pop ();
  void LoadIdentity (); 
  void LoadMatrix (const float* m);
  void MultMatrix (const float* m);
  void Translate (float x, float y, float z);
  void Scale (float x, float y, float z); 
  void Rotate (float a, float x, float y, float z);
  void LookAt (float ex, float ey, float ez, 
               float cx, float cy, float cz, 
               float ux, float uy, float uz);
  void Frustum (float xmin, float xmax, float ymin, float ymax, float znear, float zfar);   
  void Perspective (float fovy, float aspect, float znear, float zfar);
  void GetMatrix (float* m) const; 
  void GetMatrixInverse (float* mit) const;
  void GetMatrixIT (float* mit) const;
  //void Get3AdjT (float* mit);
  void SetUniformVar (int p_id);
  void GetNormalMatrix (float* dst);
  void SetActTex (bool act);
};

#endif
